package com.ld.security.common.mybatis.base.po;

import com.ld.security.common.core.base.OrderByPo;
import com.ld.security.common.core.base.QueryPo;
import com.ld.security.common.core.base.SuperPo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

/**
 * 该对象会被查询限制
 * @param <E>
 */
@Data
public class ListPo<E> implements SuperPo,OrderByPo,QueryPo<E> {


    @NotNull
    @ApiModelProperty("查询对象")
    private E query;

    @ApiModelProperty("排序字段")
    private String orderBy ;

    @ApiModelProperty("顺序")
    private boolean asc = false;

    public ListPo(E query) {
        this.query = query;
    }

    public ListPo() {
    }

    public <E> ListPo<E> newObj(){
        ListPo<E> p =new ListPo<>();
        p.setAsc(asc);
        p.setOrderBy(orderBy);
        return p;
    }

}
